-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow construction of empty Zonemaster::LDNS::RRList objects #209
Open
marc-vanderwal
wants to merge
4
commits into
zonemaster:develop
Choose a base branch
from
marc-vanderwal:bugfix/allow-empty-rrlists
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Allow construction of empty Zonemaster::LDNS::RRList objects #209
marc-vanderwal
wants to merge
4
commits into
zonemaster:develop
from
marc-vanderwal:bugfix/allow-empty-rrlists
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
marc-vanderwal
requested review from
mattias-p,
matsduf,
tgreenx and
MichaelTimbert
October 16, 2024 10:24
marc-vanderwal
changed the title
Bugfix/allow empty rrlists
Allow construction of empty Zonemaster::LDNS::RRList objects
Oct 16, 2024
CI failures seem to be addressed in #208. |
tgreenx
previously approved these changes
Oct 16, 2024
The change in zonemaster#203 introduced a new() function in the Zonemaster::LDNS::RRList module. However, calling new() with a ref to an empty array as paramater caused the code to croak with the error message "List is empty". However, there are situations where it may be desirable to construct such an empty RRList. This commit ensures that Zonemaster::LDNS::RRList->new([]) works as intended.
Modify the XS code so that Zonemaster::LDNS::RRList::new() can be called with zero arguments, which is equivalent to passing it an empty arrayref.
marc-vanderwal
force-pushed
the
bugfix/allow-empty-rrlists
branch
from
October 18, 2024 07:27
65024d6
to
a9cac1c
Compare
I’ve rebased on latest develop so that CI works, and included another minor change in |
mattias-p
previously approved these changes
Oct 18, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I like the tests you added. I thought of a few additional ones, but maybe that's overkill.
- Checking the return values of
string
,count
andget
for$empty_b
. - Checking
eq
andne
with the$empty_a
on the right side.
Let’s make sure that new() and new([]) have the same semantics, and that the eq operator works correctly in both ways with these empty lists.
tgreenx
approved these changes
Oct 21, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
This PR addresses a design oversight in the constructor for Zonemaster::LDNS::RRList objects. It was for now assumed that it would always be used to construct nonempty RRList objects, but a PR in Zonemaster-Engine elicited the need for exactly that use case.
Context
Follow-up to #203; review of zonemaster/zonemaster-engine#1383.
Changes
Allow calling Zonemaster::LDNS::RRList::new() with either no argument or an empty arrayref.
How to test this PR
Unit tests were added, and should therefore pass.